import React, { Component } from 'react';
import {
  Route,
  Link,
  Switch,
  Redirect,
} from 'react-router-dom';
import './App.less';
import RandomMM from './pages/RandomMM';
import GankArtcleList from './pages/GankArtcleList';
import GankArtcleDetail from './pages/GankArtcleDetail';


class App extends Component {

  componentDidMount() {
  }

  render() {
    return (
      <div className="app-wrap">
        <ul className="nav-header">
          <li><Link to="/random">随机图片</Link></li>
          <li><Link to="/list">干货列表</Link></li>
        </ul>
        <div className="app-main">
          <Switch>
            <Route path="/random" component={RandomMM} />
            <Route exact path="/list/:type/:pageNumber/:pageSize*" component={GankArtcleList} />
            <Redirect from="/list" to="/list/all/1" />
            <Route path="/detail/:id" component={GankArtcleDetail} />
            <Redirect exact path="/" to="/list" />
            <Route component={() => "404 Not Found ..."} />
          </Switch>
        </div>
      </div>
    );
  }
}

export default App;
